import React, { } from 'react';
import { withRouter } from 'react-router-dom'
import styled from 'styled-components';
import PropTypes from 'prop-types';

const HeaderBarWrapper = styled.header` 
  width: 100%;
  height: 45px;
  background: #50A7B7;
  color: #fff;
`;

interface HProps {
  title?: string;
  onClick?(): void,
  onBack?(): void
}

const HeaderBar = (props: HProps) => {
  console.log(props, 'props----props')
  const { title, onBack, ...restProps } = props
  return <HeaderBarWrapper {...restProps} onClick={onBack} className="header-wrapper">
    {title}
  </HeaderBarWrapper>
}

HeaderBar.defaultProps = {
  title: "头部组件"
}

export default withRouter<any, any>(HeaderBar);